<html>
<head><meta charset="utf-8"><title>First draft: A new `Try` RFC · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html">First draft: A new `Try` RFC</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="222213048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222213048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222213048">(Jan 10 2021 at 08:53)</a>:</h4>
<p>I took some time over the holidays to write up a potential direction for <code>Try</code>: <a href="https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md">https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md</a></p>
<p>There's also a proof-of-concept implementation here: <a href="https://github.com/scottmcm/rust/pull/2/files">https://github.com/scottmcm/rust/pull/2/files</a>  (It appears to work well, though it's regressed a few of the error messages.)</p>
<p>Let me know what you think, and which parts are unclear.</p>



<a name="222216626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222216626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gwaihir Thorondorsen <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222216626">(Jan 10 2021 at 10:47)</a>:</h4>
<p>In the Guide-level explanation, the <code>impl Bubble for MyResult</code> uses <code>type Holder = &lt;Result&lt;(), U&gt; as Bubble&gt;::Holder;</code> and justifies using unit instead of <code>T</code> to make clear it does not depend on it. That actually made things confusing to me, in particular prompting the question of whether the choice of unit vs. never had any impact. I would have found clearer to use <code>T</code> to explicit the parallel between <code>MyResult</code> and <code>Result</code> and to separately point out that the definition does not depend on <code>T</code> because <code>&lt;Result&lt;T, U&gt; as Bubble&gt;::Holder = Result&lt;!, U&gt;</code>. That would also be in line with the <code>impl</code>s for <code>Poll</code> shown later in the Reference-level explanation.</p>



<a name="222233251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222233251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222233251">(Jan 10 2021 at 18:05)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> Looks great so far, still reading and thinking...</p>



<a name="222233293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222233293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222233293">(Jan 10 2021 at 18:06)</a>:</h4>
<p>One typo: "definining"</p>



<a name="222233792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222233792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222233792">(Jan 10 2021 at 18:18)</a>:</h4>
<p>"just as a graph traversal or visitor," -&gt; "such as"?</p>



<a name="222233936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222233936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222233936">(Jan 10 2021 at 18:22)</a>:</h4>
<p>One request for the explanation: I found it very slightly harder to follow the MyResult example at first because it uses T and U as generic types but T is not the type for "Terrible". But I see the benefit of using the same T and U as the control type. Would you consider changing MyResult to use, for instance, "Terrific" and "Unfortunate", for purely didactic reasons? :)</p>



<a name="222234914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222234914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222234914">(Jan 10 2021 at 18:45)</a>:</h4>
<p>This looks <em>great</em>. I love that the user has control over whether to use From.</p>



<a name="222234998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222234998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222234998">(Jan 10 2021 at 18:47)</a>:</h4>
<p>As far as I can tell, this is flexible enough to allow the use of ? in the Linux kernel on a special "errno or pointer, in one word" type.</p>



<a name="222236081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222236081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222236081">(Jan 10 2021 at 19:13)</a>:</h4>
<p>Another nit: since ControlFlow has the generic arguments in the order "B, C", could it have the enum values in the same order? Break then Continue?</p>



<a name="222236082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222236082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222236082">(Jan 10 2021 at 19:13)</a>:</h4>
<p>In the implementation of from_holder for Option, is there any reason to use a match statement rather than just ignoring the argument and always returning None?</p>



<a name="222236083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222236083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222236083">(Jan 10 2021 at 19:13)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> I'm really amused by "mod sadness", and I hope that ends up in the final implementation. :)</p>



<a name="222236588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222236588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222236588">(Jan 10 2021 at 19:15)</a>:</h4>
<p>I won't comment on the specifics of yeet, since you requested avoiding that. I do appreciate that you observed the flexibility there, and I look forward to a <em>subsequent</em> RFC defining that.</p>



<a name="222236690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222236690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222236690">(Jan 10 2021 at 19:15)</a>:</h4>
<p>I like the possibilities.</p>



<a name="222236962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222236962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222236962">(Jan 10 2021 at 19:17)</a>:</h4>
<p>On sadness: Who needs custom error messages when you can have really long type names? <span aria-label="smirk" class="emoji emoji-1f60f" role="img" title="smirk">:smirk:</span></p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">error</span><span class="p">[</span><span class="n">E0277</span><span class="p">]</span>: <span class="nc">the</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">bound</span><span class="w"> </span><span class="err">`</span><span class="p">()</span>: <span class="nb">From</span><span class="o">&lt;</span><span class="n">result</span>::<span class="n">sadness</span>::<span class="n">PleaseCallTheOkOrMethodToUseQuestionMarkOnOptionsInAMethodThatReturnsResult</span><span class="o">&gt;</span><span class="err">`</span><span class="w"> </span><span class="n">is</span><span class="w"> </span><span class="n">not</span><span class="w"> </span><span class="n">satisfied</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span>-&gt; <span class="cp">$DIR</span><span class="o">/</span><span class="n">option</span><span class="o">-</span><span class="n">to</span><span class="o">-</span><span class="n">result</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">5</span>:<span class="mi">5</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="n">LL</span><span class="w"> </span><span class="o">|</span><span class="w">     </span><span class="n">a</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">     </span><span class="o">^^</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="err">`</span><span class="nb">From</span><span class="o">&lt;</span><span class="n">result</span>::<span class="n">sadness</span>::<span class="n">PleaseCallTheOkOrMethodToUseQuestionMarkOnOptionsInAMethodThatReturnsResult</span><span class="o">&gt;</span><span class="err">`</span><span class="w"> </span><span class="n">is</span><span class="w"> </span><span class="n">not</span><span class="w"> </span><span class="n">implemented</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="err">`</span><span class="p">()</span><span class="err">`</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="nc">required</span><span class="w"> </span><span class="n">because</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">requirements</span><span class="w"> </span><span class="n">on</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="err">`</span><span class="n">Try2021</span><span class="o">&lt;</span><span class="nb">Option</span><span class="o">&lt;!&gt;&gt;</span><span class="err">`</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="err">`</span><span class="n">std</span>::<span class="n">result</span>::<span class="nb">Result</span><span class="o">&lt;</span><span class="p">(),</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;</span><span class="err">`</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="nc">required</span><span class="w"> </span><span class="n">by</span><span class="w"> </span><span class="err">`</span><span class="n">from_holder</span><span class="err">`</span><span class="w"></span>
</code></pre></div>
<p><a href="https://github.com/scottmcm/rust/blob/do-or-do-not/src/test/ui/option-to-result.stderr">https://github.com/scottmcm/rust/blob/do-or-do-not/src/test/ui/option-to-result.stderr</a></p>



<a name="222237017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237017">(Jan 10 2021 at 19:18)</a>:</h4>
<p>Also, don't think I didn't notice the branch name. ;)</p>



<a name="222237032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237032">(Jan 10 2021 at 19:18)</a>:</h4>
<p>PR branch names are a fun form of meta-communication.</p>



<a name="222237053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237053">(Jan 10 2021 at 19:19)</a>:</h4>
<p>Yeah, I'd be happy to have the yeet conversation in another zulip thread.  I'm just writing it that way because I want to discourage it in the eventual RFC thread on github.</p>



<a name="222237056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237056">(Jan 10 2021 at 19:19)</a>:</h4>
<p>Complete support there.</p>



<a name="222237178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237178">(Jan 10 2021 at 19:20)</a>:</h4>
<p>I think there's value in making sure that we're forward compatible with things we're likely to want to do. And that part of the conversation is worth having, on zulip in advance. Let's see to what degree we can have that part of the conversation, and allow for possible designs, without having to get into specifics about which design we want.</p>



<a name="222237237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237237">(Jan 10 2021 at 19:22)</a>:</h4>
<p>Along similar lines, I've thought a few times about having an "early success return" for try blocks. That would have an obvious desugaring here.</p>



<a name="222237425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237425">(Jan 10 2021 at 19:27)</a>:</h4>
<p>Also, we should involve the error handling project in this thread.</p>



<a name="222237501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237501">(Jan 10 2021 at 19:29)</a>:</h4>
<p><span class="user-mention" data-user-id="369545">@Gwaihir Thorondorsen</span> Good call.  I'll move all the details of the holder down to the subsection that talks about them specifically.</p>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> / <span class="user-mention" data-user-id="120791">@RalfJ</span> Typos fixed; thank you.</p>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> That's a great didactic trick.  Will do.  (I just copied it from an existing ui test without thinking too hard.)</p>



<a name="222237609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237609">(Jan 10 2021 at 19:31)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="220273">@Jane Lusby</span></p>



<a name="222237639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237639">(Jan 10 2021 at 19:31)</a>:</h4>
<p>Yeah, and libs too probably.</p>



<a name="222237791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237791">(Jan 10 2021 at 19:35)</a>:</h4>
<p>I think the required impls to use <code>ControlFlow</code> directly with the question mark operator should probably be added, e.g. <code>ControlFlow::Break(5)?</code> should work.</p>



<a name="222237856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237856">(Jan 10 2021 at 19:36)</a>:</h4>
<p>Why is it important to be able to use that type directly?</p>



<a name="222237878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237878">(Jan 10 2021 at 19:36)</a>:</h4>
<p>To write generic functions that want to do the generic equivalent of <code>Err(e)?</code> ?</p>



<a name="222237879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237879">(Jan 10 2021 at 19:36)</a>:</h4>
<p><span class="user-mention" data-user-id="229517">@Jacob Lifshay</span> Oops, brain fart on my part.  <a href="https://github.com/scottmcm/rust/blob/5fa9b9d0a315d56637b30dac9df3af796ea3bec0/library/core/src/ops/control_flow.rs#L36-L71">They're in the PoC</a>; I just forgot to copy them to the RFC.</p>



<a name="222237996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222237996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222237996">(Jan 10 2021 at 19:39)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> See things like <a href="https://github.com/rust-lang/rust/pull/78182/files#diff-9c1fed38e37f6cd826cdbddb13ae1757bebb453b72485ba9cff200fb7b2dd78eL87">https://github.com/rust-lang/rust/pull/78182/files#diff-9c1fed38e37f6cd826cdbddb13ae1757bebb453b72485ba9cff200fb7b2dd78eL87</a></p>
<p>It's particularly handy when you want to use <code>try_for_each</code> and such for its short-circuiting behaviour.</p>



<a name="222238043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238043">(Jan 10 2021 at 19:40)</a>:</h4>
<p>I noticed that the control flow enum has a separate feature gate. Would you expect that we might stabilize the new try and bubble traits and the enum at different times?</p>



<a name="222238128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238128">(Jan 10 2021 at 19:42)</a>:</h4>
<p>The enum itself is pretty uncontroversial, I think.  I'd personally like to see it stable as soon as we have the new <code>Try</code> in nightly (so we don't stabilize any new interconversions by doing so).</p>



<a name="222238232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238232">(Jan 10 2021 at 19:44)</a>:</h4>
<p>Since it's stable to call <code>try_for_each</code>, it'd be nice to be able to use <code>return ControlFlow::Break(())</code> in the argument closure.  (It makes translating to/from a <code>for</code> loop with <code>break</code> much simpler.)</p>



<a name="222238317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238317">(Jan 10 2021 at 19:46)</a>:</h4>
<p>Otherwise one ends up using <code>Err</code> for "success" (<a href="https://github.com/rust-itertools/itertools/blob/573743a097c1701ef3bf8f82a8554a71bfbf0943/src/lib.rs#L2106-L2109">example in itertools</a>) which works but causes mental dissonance when reading it.</p>



<a name="222238329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238329">(Jan 10 2021 at 19:46)</a>:</h4>
<p>Makes sense, and yeah, it would be simpler for that case.</p>



<a name="222238337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238337">(Jan 10 2021 at 19:47)</a>:</h4>
<p>For that matter, you could return Continue to translate a continue.</p>



<a name="222238343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238343">(Jan 10 2021 at 19:47)</a>:</h4>
<p>Yup!</p>



<a name="222238399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238399">(Jan 10 2021 at 19:48)</a>:</h4>
<p>I'm hoping this will also provide better idioms for other iterator operations.</p>



<a name="222238423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238423">(Jan 10 2021 at 19:49)</a>:</h4>
<p>And of course really the reason for the different feature gate is that <a href="https://github.com/rust-lang/rust/pull/76204"><code>ControlFlow</code> was moved from internal to unstable back in September</a> for uses completely disconnected from the <code>?</code> desugar.</p>



<a name="222238487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238487">(Jan 10 2021 at 19:50)</a>:</h4>
<p>For example, itertools wants to deprecate <code>Itertools::fold_while</code>, but is holding off on doing so until an option more ergonomic than <code>Err</code>-as-success is available: <a href="https://github.com/rust-itertools/itertools/issues/469#issuecomment-677729589">https://github.com/rust-itertools/itertools/issues/469#issuecomment-677729589</a></p>



<a name="222238930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238930">(Jan 10 2021 at 20:01)</a>:</h4>
<p>Makes sense!</p>



<a name="222238949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222238949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222238949">(Jan 10 2021 at 20:01)</a>:</h4>
<p>Other than the things mentioned in this topic already, is there anything you want to change before you post this as an RFC thread?</p>



<a name="222239012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222239012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222239012">(Jan 10 2021 at 20:02)</a>:</h4>
<p>Because I would love to talk about this in the next design meeting.</p>



<a name="222240213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222240213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222240213">(Jan 10 2021 at 20:23)</a>:</h4>
<p>I posted this thread basically as soon as I finished typing, so I was somewhat expecting there were some glaring faults I'd need to fix <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="222240224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222240224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222240224">(Jan 10 2021 at 20:23)</a>:</h4>
<p>I'll add a few more things from the discussion here and post an RFC PR.</p>



<a name="222242377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222242377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222242377">(Jan 10 2021 at 21:12)</a>:</h4>
<p>Thanks for the feedback, all.  I've posted it as <a href="https://github.com/rust-lang/rfcs/pull/3058">https://github.com/rust-lang/rfcs/pull/3058</a></p>



<a name="222244351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222244351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222244351">(Jan 10 2021 at 21:59)</a>:</h4>
<p>I would suggest extending the note about bikesheds to also mention yeet and try blocks.</p>



<a name="222244354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222244354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222244354">(Jan 10 2021 at 21:59)</a>:</h4>
<p>Just so people don't miss it.</p>



<a name="222373561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222373561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222373561">(Jan 11 2021 at 23:36)</a>:</h4>
<p>I've only just started reading this but wow</p>



<a name="222373601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222373601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222373601">(Jan 11 2021 at 23:37)</a>:</h4>
<p>(deleted)</p>



<a name="222493169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222493169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tavian Barnes <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222493169">(Jan 12 2021 at 20:56)</a>:</h4>
<p>What is the "accidental stablization" that led to <code>mod sadness</code> etc.?</p>



<a name="222496680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222496680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222496680">(Jan 12 2021 at 21:25)</a>:</h4>
<p>Hm, seems like this enables <code>impl Try for bool</code> :D. I've always wanted to use<code>?</code> on bools :3</p>



<a name="222505556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222505556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222505556">(Jan 12 2021 at 22:33)</a>:</h4>
<p><span class="user-mention" data-user-id="306504">@Tavian Barnes</span> the sadness is the fact that you can try an <code>Option</code> in a function returning <code>Result&lt;T, E&gt;</code>, if your <code>E</code> is abstract enough to convert from the unstable <code>NoneError</code> without naming it</p>



<a name="222505592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222505592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222505592">(Jan 12 2021 at 22:33)</a>:</h4>
<p>per <a href="https://github.com/scottmcm/rust/pull/2/files#diff-050b8356fd8c61c6156e6f2088a5d72ca330aec5c399bd781583088adea6be0f"><code>src/test/ui/try-on-option-in-result-method.rs</code></a></p>



<a name="222511795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222511795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222511795">(Jan 12 2021 at 23:38)</a>:</h4>
<p><span class="user-mention silent" data-user-id="245339">Nadrieril</span> <a href="#narrow/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC/near/222496680">said</a>:</p>
<blockquote>
<p>Hm, seems like this enables <code>impl Try for bool</code> :D. I've always wanted to use<code>?</code> on bools :3</p>
</blockquote>
<p>While yes, it would enable it (though I think the previous one would too, if slightly less nicely in certain ways), note that libs is currently inclined <em>not</em> to <code>impl Try for bool</code>: <a href="https://github.com/rust-lang/rust/pull/76041#issuecomment-731164074">https://github.com/rust-lang/rust/pull/76041#issuecomment-731164074</a></p>



<a name="222514052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222514052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222514052">(Jan 13 2021 at 00:06)</a>:</h4>
<p>I hope libs does <em>not</em> do so, but I won't be surprised at all if a third-party crate does (using a newtype).</p>



<a name="222519110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/222519110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#222519110">(Jan 13 2021 at 01:11)</a>:</h4>
<p>Yeah, I wouldn't have expected nor wanted official support, it sounds confusing ^^</p>



<a name="223581013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581013">(Jan 21 2021 at 22:36)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> in the RFC right above <a href="https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#enabling-result-like-error-conversion">https://github.com/scottmcm/rfcs/blob/do-or-do-not/text/0000-try-trait-v2.md#enabling-result-like-error-conversion</a></p>



<a name="223581034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581034">(Jan 21 2021 at 22:37)</a>:</h4>
<p>the RFC mentions</p>



<a name="223581036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581036">(Jan 21 2021 at 22:37)</a>:</h4>
<blockquote>
<p>As expected, the mixing in bar no longer compiles:</p>
</blockquote>



<a name="223581083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581083">(Jan 21 2021 at 22:37)</a>:</h4>
<p>i think i understand what you meant</p>



<a name="223581092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581092">(Jan 21 2021 at 22:37)</a>:</h4>
<p>im guessing it's referring to this fn</p>



<a name="223581096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581096">(Jan 21 2021 at 22:37)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">MyResult</span><span class="o">&lt;</span><span class="p">(),</span><span class="w"> </span><span class="kt">f32</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span>: <span class="p">()</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">Err</span><span class="p">(</span><span class="mf">1.1</span><span class="p">)</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="n">MyResult</span>::<span class="n">Terrific</span><span class="p">(())</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="223581121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581121">(Jan 21 2021 at 22:38)</a>:</h4>
<p>it was a bit confusing though</p>



<a name="223581160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581160">(Jan 21 2021 at 22:38)</a>:</h4>
<p>because that is from the previous section</p>



<a name="223581191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581191">(Jan 21 2021 at 22:38)</a>:</h4>
<p>_ever so slowly continues reading RFC_</p>



<a name="223581227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581227">(Jan 21 2021 at 22:38)</a>:</h4>
<p>also, i can leave this as a review comment if you'd prefer (probably should have to start)</p>



<a name="223581752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581752">(Jan 21 2021 at 22:44)</a>:</h4>
<p>Yeah, those references are definitely confusing.  I need to do some major reworking of the guide especially (<a href="https://github.com/rust-lang/rfcs/pull/3058#issuecomment-760328259">https://github.com/rust-lang/rfcs/pull/3058#issuecomment-760328259</a>).</p>
<p>Feel free to leave feedback wherever is most convenient.</p>



<a name="223581855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223581855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223581855">(Jan 21 2021 at 22:45)</a>:</h4>
<p>(And if you want to wait for the next version before digging in deeply, feel free to do that too.)</p>



<a name="223582231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223582231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223582231">(Jan 21 2021 at 22:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC/near/223581855">said</a>:</p>
<blockquote>
<p>(And if you want to wait for the next version before digging in deeply, feel free to do that too.)</p>
</blockquote>
<p>oh, okay</p>



<a name="223582297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223582297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223582297">(Jan 21 2021 at 22:50)</a>:</h4>
<p>can you ping me when the next revision is ready for review?</p>



<a name="223587053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223587053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223587053">(Jan 21 2021 at 23:45)</a>:</h4>
<p>Wilco</p>



<a name="223839771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223839771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223839771">(Jan 24 2021 at 22:34)</a>:</h4>
<p>I'm planning on this structure to the traits: <a href="https://github.com/scottmcm/rust/blob/68af673184871acb66fbfb12c76df204247cac56/library/core/src/ops/try.rs#L88-L145">https://github.com/scottmcm/rust/blob/68af673184871acb66fbfb12c76df204247cac56/library/core/src/ops/try.rs#L88-L145</a></p>
<p>Feel free to suggest better names.  Still working on the text updates.</p>



<a name="223844348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223844348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223844348">(Jan 25 2021 at 00:13)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span> for <code>GetCorrespondingTryType</code>, I think it reads well as a bound</p>



<a name="223844753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223844753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223844753">(Jan 25 2021 at 00:23)</a>:</h4>
<p>I shared my take on the <code>Residual</code> bikeshed <a href="#narrow/stream/213817-t-lang/topic/Design.20meeting.202021-01-13.3A.20try_trait_v2/near/222887954">here</a>. My take is that I think it's clearer if we make the <code>Residual</code> type more central, as opposed to the <code>Self</code> type that implements <code>Try</code>, since it's the <code>Residual</code> that "moves around" and gets converted to other things. The only difference would be a more catchy name than <code>Residual</code>, and reflecting this emphasis in the docs. I proposed <code>ShortCircuit</code>. The rest of the naming LGTM.</p>



<a name="223884924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223884924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223884924">(Jan 25 2021 at 11:43)</a>:</h4>
<p>My .02 on naming: although it "makes sense" in a type-level-programming point of view, I think we should avoid having too many <code>Output</code>-named associated types. I, for instance, like the linked snippet better with <code>Ok</code> than with yet-another-output. In that regard, <span class="user-mention" data-user-id="245339">@Nadrieril</span>'s suggestions might very well come in handy <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>
<p>Also, in the realm of bikeshedding / ergonomics / stuff that is not urgent / important to get right right now, but just good to keep in mind, in order to alleviate a bit some notations, some type aliases can come in handy.</p>
<p>So, for instance (and modulo naming!), I could imagine there being:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// The bound here is for documentation purposes.</span>
<span class="k">type</span> <span class="nc">TryType</span><span class="o">&lt;</span><span class="nb">Ok</span><span class="p">,</span><span class="w"> </span><span class="n">Residual</span>: <span class="nc">GetCorrespondingTryType</span><span class="o">&lt;</span><span class="nb">Ok</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Residual</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">GetCorrespondingTryType</span><span class="o">&lt;</span><span class="nb">Ok</span><span class="o">&gt;&gt;</span>::<span class="n">Output</span><span class="p">;</span><span class="w"></span>

<span class="c1">// so that map signatures becomes:</span>
<span class="k">fn</span> <span class="nf">map</span><span class="o">&lt;</span><span class="n">Ok2</span><span class="o">&gt;</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">f</span>: <span class="nc">impl</span><span class="w"> </span><span class="nb">FnOnce</span><span class="p">(</span><span class="bp">Self</span>::<span class="nb">Ok</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Ok2</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">TryType</span><span class="o">&lt;</span><span class="n">Ok2</span><span class="p">,</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">Residual</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="bp">Self</span>: <span class="nc">Try2021</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="bp">Self</span>::<span class="n">Residual</span>: <span class="nc">GetCorrespondingTryType</span><span class="o">&lt;</span><span class="n">Ok2</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">branch</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">ControlFlow</span>::<span class="n">Continue</span><span class="p">(</span><span class="n">c</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">Try2021</span>::<span class="n">from_ok</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">c</span><span class="p">)),</span><span class="w"></span>
<span class="w">        </span><span class="n">ControlFlow</span>::<span class="n">Break</span><span class="p">(</span><span class="n">r</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">FromTryResidual</span>::<span class="n">from_residual</span><span class="p">(</span><span class="n">r</span><span class="p">),</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Other than these nits, I like the direction this is going very much <span aria-label="ok" class="emoji emoji-1f44c" role="img" title="ok">:ok:</span></p>



<a name="223927217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223927217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223927217">(Jan 25 2021 at 16:59)</a>:</h4>
<p>Yeah, naming associated types is hard.  I decided to try <code>Try::Output</code> this time the same way it's <code>Add::Output</code> and not <code>Add::Sum</code>.</p>
<p>But hopefully someone will come up with an "oh that's perfect!" name...</p>



<a name="223939671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/First%20draft%3A%20A%20new%20%60Try%60%20RFC/near/223939671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/First.20draft.3A.20A.20new.20.60Try.60.20RFC.html#223939671">(Jan 25 2021 at 18:28)</a>:</h4>
<p>I honestly like <code>Output</code> for consistency, as it really is the output of the expression, just like <code>Add</code>/etc.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>